package first.niuke.simple;

import java.util.Arrays;

/**
 * @ClassName NC63
 * @description:
 * @author: 荣燊
 * @create: 2021-06-13 21:51
 **/
public class NC63 {
    public static void main(String[] args) {
//        int[] a = {5, 4, 6, 9, 3, 1, 10};
//        HashSet<Integer> set = new HashSet<>();
//        for (int i : a) {
//            set.add(i);
//        }
//        for (int j : set) {
//            System.out.println(j);
//        }
        int[] s = {1,3,0,7,0};
        System.out.println(IsContinuous(s));
    }

    // 扑克牌顺子
    public static boolean IsContinuous(int[] numbers) {
        // 最大值减最小值应该小于5
        // 排序
        Arrays.sort(numbers);
        int j=0;
        for (int i=0; i<numbers.length; i++) {
            if (numbers[i] == 0) {
                ++j;
                continue;
            }
            // 排除重复值
            if (j+1<numbers.length && numbers[j] == numbers[j+1]) {
                return false;
            }
        }
        return numbers[numbers.length-1]-numbers[j] < 5;
    }
}
